home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 June / SGI IRIX Patches 1995 Jun.iso / 5.3_patches / patchSG0000499 / patchSG0000499.idb / usr / include / abi / X11 / Xlibint.h.z / Xlibint.h
Encoding:
C/C++ Source or Header  |  1995-06-12  |  34.8 KB  |  1,268 lines

  1. /* $XConsortium: Xlibint.h,v 11.97.1.1 93/04/26 17:54:27 mor Exp $ */
  2. /* Copyright 1984, 1985, 1987, 1989  Massachusetts Institute of Technology */
  3.  
  4. /*
  5. Permission to use, copy, modify, distribute, and sell this software and its
  6. documentation for any purpose is hereby granted without fee, provided that
  7. the above copyright notice appear in all copies and that both that
  8. copyright notice and this permission notice appear in supporting
  9. documentation, and that the name of M.I.T. not be used in advertising or
  10. publicity pertaining to distribution of the software without specific,
  11. written prior permission.  M.I.T. makes no representations about the
  12. suitability of this software for any purpose.  It is provided "as is"
  13. without express or implied warranty.
  14. */
  15.  
  16. /*
  17.  *    Xlibint.h - Header definition and support file for the internal
  18.  *    support routines used by the C subroutine interface
  19.  *    library (Xlib) to the X Window System.
  20.  *
  21.  *    Warning, there be dragons here....
  22.  */
  23.  
  24. #ifndef NEED_EVENTS
  25. #define _XEVENT_
  26. #endif
  27.  
  28. #include <X11/Xlib.h>
  29.  
  30. struct _XGC {
  31.     XExtData *ext_data;    /* hook for extension to hang data */
  32.     GContext gid;    /* protocol ID for graphics context */
  33.     Bool rects;        /* boolean: TRUE if clipmask is list of rectangles */
  34.     Bool dashes;    /* boolean: TRUE if dash-list is really a list */
  35.     unsigned long dirty;/* cache dirty bits */
  36.     XGCValues values;    /* shadow structure of values */
  37. };
  38.  
  39. struct _XDisplay {
  40.     XExtData *ext_data;    /* hook for extension to hang data */
  41.     struct _XFreeFuncs *free_funcs; /* internal free functions */
  42.     int fd;            /* Network socket. */
  43.     int conn_checker;         /* ugly thing used by _XEventsQueued */
  44.     int proto_major_version;/* maj. version of server's X protocol */
  45.     int proto_minor_version;/* minor version of servers X protocol */
  46.     char *vendor;        /* vendor of the server hardware */
  47.         XID resource_base;    /* resource ID base */
  48.     XID resource_mask;    /* resource ID mask bits */
  49.     XID resource_id;    /* allocator current ID */
  50.     int resource_shift;    /* allocator shift to correct bits */
  51. #if NeedFunctionPrototypes
  52.     XID (*resource_alloc)(Display *);/* allocator function */
  53. #else 
  54.     XID (*resource_alloc)();/* allocator function */
  55. #endif
  56.     int byte_order;        /* screen byte order, LSBFirst, MSBFirst */
  57.     int bitmap_unit;    /* padding and data requirements */
  58.     int bitmap_pad;        /* padding requirements on bitmaps */
  59.     int bitmap_bit_order;    /* LeastSignificant or MostSignificant */
  60.     int nformats;        /* number of pixmap formats in list */
  61.     ScreenFormat *pixmap_format;    /* pixmap format list */
  62.     int vnumber;        /* Xlib's X protocol version number. */
  63.     int release;        /* release of the server */
  64.     struct _XSQEvent *head, *tail;    /* Input event queue. */
  65.     int qlen;        /* Length of input event queue */
  66.     unsigned long last_request_read; /* seq number of last event read */
  67.     unsigned long request;    /* sequence number of last request. */
  68.     char *last_req;        /* beginning of last request, or dummy */
  69.     char *buffer;        /* Output buffer starting address. */
  70.     char *bufptr;        /* Output buffer index pointer. */
  71.     char *bufmax;        /* Output buffer maximum+1 address. */
  72.     unsigned max_request_size; /* maximum number 32 bit words in request*/
  73.     struct _XrmHashBucketRec *db;
  74. #if NeedFunctionPrototypes
  75.     int (*synchandler)(Display *);    /* Synchronization handler */
  76. #else 
  77.     int (*synchandler)();    /* Synchronization handler */
  78. #endif
  79.     char *display_name;    /* "host:display" string used on this connect*/
  80.     int default_screen;    /* default screen for operations */
  81.     int nscreens;        /* number of screens on this server*/
  82.     Screen *screens;    /* pointer to list of screens */
  83.     unsigned long motion_buffer;    /* size of motion buffer */
  84.     unsigned long flags;       /* internal connection flags */
  85.     int min_keycode;    /* minimum defined keycode */
  86.     int max_keycode;    /* maximum defined keycode */
  87.     KeySym *keysyms;    /* This server's keysyms */
  88.     XModifierKeymap *modifiermap;    /* This server's modifier keymap */
  89.     int keysyms_per_keycode;/* number of rows */
  90.     char *xdefaults;    /* contents of defaults from server */
  91.     char *scratch_buffer;    /* place to hang scratch buffer */
  92.     unsigned long scratch_length;    /* length of scratch buffer */
  93.     int ext_number;        /* extension number on this display */
  94.     struct _XExten *ext_procs; /* extensions initialized on this display */
  95.     /*
  96.      * the following can be fixed size, as the protocol defines how
  97.      * much address space is available. 
  98.      * While this could be done using the extension vector, there
  99.      * may be MANY events processed, so a search through the extension
  100.      * list to find the right procedure for each event might be
  101.      * expensive if many extensions are being used.
  102.      */
  103.     Bool (*event_vec[128])();  /* vector for wire to event */
  104.     Status (*wire_vec[128])(); /* vector for event to wire */
  105.     KeySym lock_meaning;       /* for XLookupString */
  106.     XPointer lock;        /* is someone in critical section? */
  107.     struct _XInternalAsync *async_handlers; /* for internal async */
  108.     unsigned long bigreq_size; /* max size of big requests */
  109.     /* things above this line should not move, for binary compatibility */
  110.     struct _XKeytrans *key_bindings; /* for XLookupString */
  111.     Font cursor_font;       /* for XCreateFontCursor */
  112.     struct _XDisplayAtoms *atoms; /* for XInternAtom */
  113.     unsigned int mode_switch;  /* keyboard group modifiers */
  114.     struct _XContextDB *context_db; /* context database */
  115.     Bool (**error_vec)();      /* vector for wire to error */
  116.     /*
  117.      * Xcms information
  118.      */
  119.     struct {
  120.        XPointer defaultCCCs;  /* pointer to an array of default XcmsCCC */
  121.        XPointer clientCmaps;  /* pointer to linked list of XcmsCmapRec */
  122.        XPointer perVisualIntensityMaps;
  123.                   /* linked list of XcmsIntensityMap */
  124.     } cms;
  125.     struct _XIMFilter *im_filters;
  126.     unsigned char pad1;
  127.     unsigned char pad2;
  128.     unsigned char level3_shift;  /* level 3 Shift modifiers */
  129.     unsigned char num_lock;     /* numlock modifiers */
  130. #ifndef NO_XKB_EXTENSION
  131.     unsigned     xkb_flags;
  132.     int         xkb_ext_number;
  133.     int         xkb_ext_major_opcode;
  134.     int         xkb_ext_event_base;
  135.     int         xkb_ext_error_base;
  136.     int         xkb_srv_major;
  137.     int         xkb_srv_minor;
  138.     unsigned     xkb_selected_events;
  139.     struct _XkbInfoRec    *xkb_info;
  140. #endif
  141. #ifdef SGI_SHM_TRANS
  142.         struct _shmdata *shmdata;  /* used for sgi shared memory transport */
  143. #endif /* SGI_SHM_TRANS */
  144. };
  145.  
  146. /*
  147.  * define the following if you want the Data macro to be a procedure instead
  148.  */
  149. #ifdef CRAY
  150. #define DataRoutineIsProcedure
  151. #endif /* CRAY */
  152.  
  153. #ifndef _XEVENT_
  154. /*
  155.  * _QEvent datatype for use in input queueing.
  156.  */
  157. typedef struct _XSQEvent {
  158.     struct _XSQEvent *next;
  159.     XEvent event;
  160. } _XQEvent;
  161. #endif
  162.  
  163. #if NeedFunctionPrototypes    /* prototypes require event type definitions */
  164. #define NEED_EVENTS
  165. #endif
  166. #include <X11/Xproto.h>
  167.  
  168. #ifdef __sgi
  169. #define _SGI_MP_SOURCE    /* turn this on to get MP safe errno */
  170. #endif /* __sgi */
  171.  
  172. #include <errno.h>
  173.  
  174. #ifdef __sgi
  175. #undef _SGI_MP_SOURCE    /* turn it off again to avoid getting (slower) MP safe stdio */
  176. #endif /* __sgi */
  177.  
  178. #define _XBCOPYFUNC _Xbcopy
  179. #include <X11/Xfuncs.h>
  180. #include <X11/Xosdefs.h>
  181.  
  182. #ifdef SGI_SHM_TRANS
  183. #include <ulocks.h>
  184. #include "XShmTrans.h"
  185. #endif /* SGI_SHM_TRANS */
  186.  
  187. /* Utek leaves kernel macros around in include files (bleah) */
  188. #ifdef dirty
  189. #undef dirty
  190. #endif
  191.  
  192. #ifdef CRAY
  193. #define WORD64
  194. #endif
  195.  
  196. #ifndef X_NOT_STDC_ENV
  197. #include <stdlib.h>
  198. #include <string.h>
  199. #else
  200. char *malloc(), *realloc(), *calloc();
  201. void exit();
  202. #ifdef SYSV
  203. #include <string.h>
  204. #else
  205. #include <strings.h>
  206. #endif
  207. #endif
  208. #if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
  209. char *malloc(), *realloc(), *calloc();
  210. #endif /* macII */
  211.  
  212. /*
  213.  * The following definitions can be used for locking requests in multi-threaded
  214.  * address spaces.
  215.  */
  216. #define LockDisplay(dis)
  217. #define LockMutex(mutex)
  218. #define UnlockMutex(mutex)
  219. #define UnlockDisplay(dis)
  220. #define Xfree(ptr) free((ptr))
  221.  
  222. /*
  223.  * Note that some machines do not return a valid pointer for malloc(0), in
  224.  * which case we provide an alternate under the control of the
  225.  * define MALLOC_0_RETURNS_NULL.  This is necessary because some
  226.  * Xlib code expects malloc(0) to return a valid pointer to storage.
  227.  */
  228. #ifdef MALLOC_0_RETURNS_NULL
  229.  
  230. # define Xmalloc(size) malloc(((size) > 0 ? (size) : 1))
  231. # define Xrealloc(ptr, size) realloc((ptr), ((size) > 0 ? (size) : 1))
  232. # define Xcalloc(nelem, elsize) calloc(((nelem) > 0 ? (nelem) : 1), (elsize))
  233.  
  234. #else
  235.  
  236. # define Xmalloc(size) malloc((size))
  237. # define Xrealloc(ptr, size) realloc((ptr), (size))
  238. # define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
  239.  
  240. #endif
  241.  
  242. #ifndef NULL
  243. #define NULL 0
  244. #endif
  245. #define LOCKED 1
  246. #define UNLOCKED 0
  247.  
  248. extern int errno;            /* Internal system error number. */
  249.  
  250. #ifndef BUFSIZE
  251. #define BUFSIZE 2048            /* X output buffer size. */
  252. #endif
  253. #ifndef PTSPERBATCH
  254. #define PTSPERBATCH 1024        /* point batching */
  255. #endif
  256. #ifndef WLNSPERBATCH
  257. #define WLNSPERBATCH 50            /* wide line batching */
  258. #endif
  259. #ifndef ZLNSPERBATCH
  260. #define ZLNSPERBATCH 1024        /* thin line batching */
  261. #endif
  262. #ifndef WRCTSPERBATCH
  263. #define WRCTSPERBATCH 10        /* wide line rectangle batching */
  264. #endif
  265. #ifndef ZRCTSPERBATCH
  266. #define ZRCTSPERBATCH 256        /* thin line rectangle batching */
  267. #endif
  268. #ifndef FRCTSPERBATCH
  269. #define FRCTSPERBATCH 256        /* filled rectangle batching */
  270. #endif
  271. #ifndef FARCSPERBATCH
  272. #define FARCSPERBATCH 256        /* filled arc batching */
  273. #endif
  274. #ifndef CURSORFONT
  275. #define CURSORFONT "cursor"        /* standard cursor fonts */
  276. #endif
  277.  
  278. /*
  279.  * display flags
  280.  */
  281. #define XlibDisplayIOError    (1L << 0)
  282. #define XlibDisplayClosing    (1L << 1)
  283. #define    XlibDisplayNoXkb    (1L << 2)
  284.  
  285. /*
  286.  * X Protocol packetizing macros.
  287.  */
  288.  
  289. /*   Need to start requests on 64 bit word boundries
  290.  *   on a CRAY computer so add a NoOp (127) if needed.
  291.  *   A character pointer on a CRAY computer will be non-zero
  292.  *   after shifting right 61 bits of it is not pointing to
  293.  *   a word boundary.
  294.  */
  295. #ifdef WORD64
  296. #define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
  297.            dpy->last_req = dpy->bufptr;\
  298.            *(dpy->bufptr)   = X_NoOperation;\
  299.            *(dpy->bufptr+1) =  0;\
  300.            *(dpy->bufptr+2) =  0;\
  301.            *(dpy->bufptr+3) =  1;\
  302.              dpy->request++;\
  303.              dpy->bufptr += 4;\
  304.          }
  305. #else /* else does not require alignment on 64-bit boundaries */
  306. #define WORD64ALIGN
  307. #endif /* WORD64 */
  308.  
  309. /* macros used by shared memory transport */
  310. #ifdef SGI_SHM_TRANS
  311.  
  312. /* do n bytes fit in buffer?? */
  313. #define SHM_BYTES_FIT( head, tail, endofbuf, n) \
  314.     ( ( (tail) <= (head) ) ? \
  315.         ( ( (head) + (n) ) < (endofbuf) ) : \
  316.         ( ( (head) + (n) ) < (tail) ) )
  317.  
  318. #define _XShmAlloc( ret, type, my_shmptr, my_dpy, nbytes ) \
  319. { \
  320.     arenahdr_t *my_arenahdr = (my_shmptr)->arenahdr; \
  321.     unsigned char *my_tailptr = (unsigned char *)my_arenahdr->tailptr; \
  322.     if ( (my_dpy)->bufptr != (my_dpy)->buffer ) \
  323.         _XShmCompatBufCopy(my_dpy); \
  324.     if ( SHM_BYTES_FIT( (my_shmptr)->reqendptr, my_tailptr, \
  325.                 my_arenahdr->shmbufend, (nbytes) ) ) \
  326.     { \
  327. /* printf("_XShmAlloc:n = %d, ret = 0x%x, tail = 0x%x\n", nbytes, (my_shmptr)->reqendptr, my_tailptr); */ \
  328.         (ret) = (type)((my_shmptr)->reqendptr); \
  329.         (my_shmptr)->reqendptr += nbytes; \
  330.     } \
  331.     else \
  332.     { \
  333.         (ret) = (type) _XShmRealAlloc( (my_dpy), (nbytes) ); \
  334.     } \
  335. }
  336. #endif /* SGI_SHM_TRANS */
  337.  
  338. /*
  339.  * GetReq - Get the next avilable X request packet in the buffer and
  340.  * return it. 
  341.  *
  342.  * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
  343.  * "req" is the name of the request pointer.
  344.  *
  345.  */
  346.  
  347. #ifdef SGI_SHM_TRANS
  348.  
  349. #if defined(__STDC__) && !defined(UNIXCPP)
  350. #define GetReq(name, req) \
  351.     WORD64ALIGN\
  352.     { \
  353.     shmdata_t *shmdata = dpy->shmdata;\
  354.     if ( shmdata ) \
  355.     { \
  356.         shmdata->curreqptr = shmdata->reqendptr; \
  357.         _XShmAlloc(req, x##name##Req *, shmdata, dpy, SIZEOF(x##name##Req) );\
  358.         shmdata->curreqptr = (unsigned char *) req ; \
  359.     } \
  360.     else \
  361.     { \
  362.         if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
  363.         _XFlush(dpy);\
  364.         req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
  365.         dpy->bufptr += SIZEOF(x##name##Req);\
  366.     } \
  367.     } \
  368.     req->reqType = X_##name;\
  369.     req->length = (SIZEOF(x##name##Req))>>2;\
  370.     dpy->request++
  371.  
  372. #else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
  373. #define GetReq(name, req) \
  374.     WORD64ALIGN\
  375.     { \
  376.     shmdata_t *shmdata = dpy->shmdata;\
  377.     if ( shmdata ) \
  378.     { \
  379.         shmdata->curreqptr = shmdata->reqendptr; \
  380.         _XShmAlloc(req, x/**/name/**/Req *, shmdata, dpy, SIZEOF(x/**/name/**/Req) );\
  381.         shmdata->curreqptr = (unsigned char *) req ; \
  382.     } \
  383.     else \
  384.     { \
  385.         if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
  386.         _XFlush(dpy);\
  387.         req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
  388.         dpy->bufptr += SIZEOF(x/**/name/**/Req);\
  389.     } \
  390.     } \
  391.     req->reqType = X_/**/name;\
  392.     req->length = (SIZEOF(x/**/name/**/Req))>>2;\
  393.     dpy->request++
  394. #endif
  395.  
  396. #else /* SGI_SHM_TRANS */
  397.  
  398. #if defined(__STDC__) && !defined(UNIXCPP)
  399. #define GetReq(name, req) \
  400.         WORD64ALIGN\
  401.     if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
  402.         _XFlush(dpy);\
  403.     req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
  404.     req->reqType = X_##name;\
  405.     req->length = (SIZEOF(x##name##Req))>>2;\
  406.     dpy->bufptr += SIZEOF(x##name##Req);\
  407.     dpy->request++
  408.  
  409. #else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
  410. #define GetReq(name, req) \
  411.         WORD64ALIGN\
  412.     if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
  413.         _XFlush(dpy);\
  414.     req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
  415.     req->reqType = X_/**/name;\
  416.     req->length = (SIZEOF(x/**/name/**/Req))>>2;\
  417.     dpy->bufptr += SIZEOF(x/**/name/**/Req);\
  418.     dpy->request++
  419. #endif
  420.  
  421. #endif /* SGI_SHM_TRANS */
  422.  
  423. /* GetReqExtra is the same as GetReq, but allocates "n" additional
  424.    bytes after the request. "n" must be a multiple of 4!  */
  425.  
  426. #ifdef SGI_SHM_TRANS
  427.  
  428. #if defined(__STDC__) && !defined(UNIXCPP)
  429. #define GetReqExtra(name, n, req) \
  430.     WORD64ALIGN\
  431.     { \
  432.     shmdata_t *shmdata = dpy->shmdata;\
  433.     if ( shmdata ) \
  434.     { \
  435.         shmdata->curreqptr = shmdata->reqendptr; \
  436.         _XShmAlloc(req, x##name##Req *, shmdata, dpy, SIZEOF(x##name##Req) + n );\
  437.         shmdata->curreqptr = (unsigned char *) req ; \
  438.     } \
  439.     else \
  440.     { \
  441.         if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
  442.         _XFlush(dpy);\
  443.         req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
  444.         dpy->bufptr += SIZEOF(x##name##Req) + n;\
  445.     } \
  446.     } \
  447.     req->reqType = X_##name;\
  448.     req->length = (SIZEOF(x##name##Req) + n)>>2;\
  449.     dpy->request++
  450. #else
  451. #define GetReqExtra(name, n, req) \
  452.     WORD64ALIGN\
  453.     { \
  454.     shmdata_t *shmdata = dpy->shmdata;\
  455.     if ( shmdata ) \
  456.     { \
  457.         shmdata->curreqptr = shmdata->reqendptr; \
  458.         _XShmAlloc(req, x/**/name/**/Req *, shmdata, dpy, SIZEOF(x/**/name/**/Req) + n );\
  459.         shmdata->curreqptr = (unsigned char *) req ; \
  460.     } \
  461.     else \
  462.     { \
  463.         if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
  464.         _XFlush(dpy);\
  465.         req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
  466.         dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
  467.     } \
  468.     } \
  469.     req->reqType = X_/**/name;\
  470.     req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
  471.     dpy->request++
  472. #endif
  473.  
  474. #else /* SGI_SHM_TRANS */
  475.  
  476. #if defined(__STDC__) && !defined(UNIXCPP)
  477. #define GetReqExtra(name, n, req) \
  478.         WORD64ALIGN\
  479.     if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
  480.         _XFlush(dpy);\
  481.     req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
  482.     req->reqType = X_##name;\
  483.     req->length = (SIZEOF(x##name##Req) + n)>>2;\
  484.     dpy->bufptr += SIZEOF(x##name##Req) + n;\
  485.     dpy->request++
  486. #else
  487. #define GetReqExtra(name, n, req) \
  488.         WORD64ALIGN\
  489.     if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
  490.         _XFlush(dpy);\
  491.     req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
  492.     req->reqType = X_/**/name;\
  493.     req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
  494.     dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
  495.     dpy->request++
  496. #endif
  497.  
  498. #endif /* SGI_SHM_TRANS */
  499.  
  500. /*
  501.  * GetResReq is for those requests that have a resource ID 
  502.  * (Window, Pixmap, GContext, etc.) as their single argument.
  503.  * "rid" is the name of the resource. 
  504.  */
  505.  
  506. #ifdef SGI_SHM_TRANS
  507.  
  508. #if defined(__STDC__) && !defined(UNIXCPP)
  509. #define GetResReq(name, rid, req) \
  510.     WORD64ALIGN\
  511.     { \
  512.     shmdata_t *shmdata = dpy->shmdata;\
  513.     if ( shmdata ) \
  514.     { \
  515.         shmdata->curreqptr = shmdata->reqendptr; \
  516.         _XShmAlloc(req, xResourceReq *, shmdata, dpy, SIZEOF(xResourceReq) );\
  517.         shmdata->curreqptr = (unsigned char *) req ; \
  518.     } \
  519.     else \
  520.     { \
  521.         if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
  522.         _XFlush(dpy);\
  523.         req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
  524.         dpy->bufptr += SIZEOF(xResourceReq);\
  525.     } \
  526.     } \
  527.     req->reqType = X_##name;\
  528.     req->length = 2;\
  529.     req->id = (rid);\
  530.     dpy->request++
  531. #else
  532. #define GetResReq(name, rid, req) \
  533.     WORD64ALIGN\
  534.     { \
  535.     shmdata_t *shmdata = dpy->shmdata;\
  536.     if ( shmdata ) \
  537.     { \
  538.         shmdata->curreqptr = shmdata->reqendptr; \
  539.         _XShmAlloc(req, xResourceReq *, shmdata, dpy, SIZEOF(xResourceReq) );\
  540.         shmdata->curreqptr = (unsigned char *) req ; \
  541.     } \
  542.     else \
  543.     { \
  544.         if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
  545.         _XFlush(dpy);\
  546.         req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
  547.         dpy->bufptr += SIZEOF(xResourceReq);\
  548.     } \
  549.     } \
  550.     req->reqType = X_/**/name;\
  551.     req->length = 2;\
  552.     req->id = (rid);\
  553.     dpy->request++
  554. #endif
  555.  
  556. #else /* SGI_SHM_TRANS */
  557.  
  558. #if defined(__STDC__) && !defined(UNIXCPP)
  559. #define GetResReq(name, rid, req) \
  560.         WORD64ALIGN\
  561.     if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
  562.         _XFlush(dpy);\
  563.     req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
  564.     req->reqType = X_##name;\
  565.     req->length = 2;\
  566.     req->id = (rid);\
  567.     dpy->bufptr += SIZEOF(xResourceReq);\
  568.     dpy->request++
  569. #else
  570. #define GetResReq(name, rid, req) \
  571.         WORD64ALIGN\
  572.     if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
  573.         _XFlush(dpy);\
  574.     req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
  575.     req->reqType = X_/**/name;\
  576.     req->length = 2;\
  577.     req->id = (rid);\
  578.     dpy->bufptr += SIZEOF(xResourceReq);\
  579.     dpy->request++
  580. #endif
  581.  
  582. #endif /* SGI_SHM_TRANS */
  583.  
  584. /*
  585.  * GetEmptyReq is for those requests that have no arguments
  586.  * at all. 
  587.  */
  588.  
  589. #ifdef SGI_SHM_TRANS
  590.  
  591. #if defined(__STDC__) && !defined(UNIXCPP)
  592. #define GetEmptyReq(name, req) \
  593.     WORD64ALIGN\
  594.     { \
  595.     shmdata_t *shmdata = dpy->shmdata;\
  596.     if ( shmdata ) \
  597.     { \
  598.         shmdata->curreqptr = shmdata->reqendptr; \
  599.         _XShmAlloc(req, xReq *, shmdata, dpy, SIZEOF(xReq) );\
  600.         shmdata->curreqptr = (unsigned char *) req ; \
  601.     } \
  602.     else \
  603.     { \
  604.         if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
  605.         _XFlush(dpy);\
  606.         req = (xReq *) (dpy->last_req = dpy->bufptr);\
  607.         dpy->bufptr += SIZEOF(xReq);\
  608.     } \
  609.     } \
  610.     req->reqType = X_##name;\
  611.     req->length = 1;\
  612.     dpy->request++
  613. #else
  614. #define GetEmptyReq(name, req) \
  615.     WORD64ALIGN\
  616.     { \
  617.     shmdata_t *shmdata = dpy->shmdata;\
  618.     if ( shmdata ) \
  619.     { \
  620.         shmdata->curreqptr = shmdata->reqendptr; \
  621.         _XShmAlloc(req, xReq *, shmdata, dpy, SIZEOF(xReq) );\
  622.         shmdata->curreqptr = (unsigned char *) req ; \
  623.     } \
  624.     else \
  625.     { \
  626.         if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
  627.         _XFlush(dpy);\
  628.         req = (xReq *) (dpy->last_req = dpy->bufptr);\
  629.         dpy->bufptr += SIZEOF(xReq);\
  630.     } \
  631.     } \
  632.     req->reqType = X_/**/name;\
  633.     req->length = 1;\
  634.     dpy->request++
  635. #endif
  636.  
  637. #else /* SGI_SHM_TRANS */
  638.  
  639. #if defined(__STDC__) && !defined(UNIXCPP)
  640. #define GetEmptyReq(name, req) \
  641.         WORD64ALIGN\
  642.     if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
  643.         _XFlush(dpy);\
  644.     req = (xReq *) (dpy->last_req = dpy->bufptr);\
  645.     req->reqType = X_##name;\
  646.     req->length = 1;\
  647.     dpy->bufptr += SIZEOF(xReq);\
  648.     dpy->request++
  649. #else
  650. #define GetEmptyReq(name, req) \
  651.         WORD64ALIGN\
  652.     if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
  653.         _XFlush(dpy);\
  654.     req = (xReq *) (dpy->last_req = dpy->bufptr);\
  655.     req->reqType = X_/**/name;\
  656.     req->length = 1;\
  657.     dpy->bufptr += SIZEOF(xReq);\
  658.     dpy->request++
  659. #endif
  660.  
  661. #endif /* SGI_SHM_TRANS */
  662.  
  663. #ifdef WORD64
  664. #define MakeBigReq(req,n) \
  665.     { \
  666.     char _BRdat[4]; \
  667.     unsigned long _BRlen = req->length - 1; \
  668.     req->length = 0; \
  669.     bcopy(((char *)req) + (_BRlen << 2), _BRdat, 4); \
  670.     bcopy(((char *)req) + 4, ((char *)req) + 8, _BRlen << 2); \
  671.     bcopy(_BRdat, ((char *)req) + 4, 4); \
  672.     Data32(dpy, (long *)&_BRdat, 4); \
  673.     }
  674. #else
  675. #define MakeBigReq(req,n) \
  676.     { \
  677.     long _BRdat; \
  678.     unsigned long _BRlen = req->length - 1; \
  679.     req->length = 0; \
  680.     _BRdat = ((long *)req)[_BRlen]; \
  681.     bcopy(((char *)req) + 4, ((char *)req) + 8, _BRlen << 2); \
  682.     ((unsigned long *)req)[1] = _BRlen + n + 2; \
  683.     Data32(dpy, &_BRdat, 4); \
  684.     }
  685. #endif
  686.  
  687. #define SetReqLen(req,n,badlen) \
  688.     if ((req->length + n) > (unsigned)65535) { \
  689.     if (dpy->bigreq_size) { \
  690.         MakeBigReq(req,n) \
  691.     } else { \
  692.         n = badlen; \
  693.         req->length += n; \
  694.     } \
  695.     } else \
  696.     req->length += n
  697.  
  698. #define SyncHandle() \
  699.     if (dpy->synchandler) (*dpy->synchandler)(dpy)
  700.  
  701. #define FlushGC(dpy, gc) \
  702.     if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
  703. /*
  704.  * Data - Place data in the buffer and pad the end to provide
  705.  * 32 bit word alignment.  Transmit if the buffer fills.
  706.  *
  707.  * "dpy" is a pointer to a Display.
  708.  * "data" is a pinter to a data buffer.
  709.  * "len" is the length of the data buffer.
  710.  * we can presume buffer less than 2^16 bytes, so bcopy can be used safely.
  711.  */
  712. #ifndef DataRoutineIsProcedure
  713.  
  714. # ifdef SGI_SHM_TRANS
  715.  
  716. #define shmbcopy(src, dest, len) \
  717.     if ( ( (int)(src) | (int)(dest) | (int)(len) ) & 0x3 ) \
  718.     { /* unaligned in some way */ \
  719.         bcopy( (src), (dest), (len) ); \
  720.     } \
  721.     else /* src and dest are word aligned, and length is mod 4 */ \
  722.     { \
  723.         int wordlen = (len) >> 2; \
  724.         if ( wordlen > 31 ) \
  725.         { \
  726.             _XShmFastBcopy( (src), (dest), (len) ); \
  727.         } \
  728.         else \
  729.         { \
  730.             volatile unsigned int *mysrc; \
  731.             volatile unsigned int *mydest; \
  732.             mysrc = (volatile unsigned int *)(src); \
  733.             mydest = (volatile unsigned int *)(dest); \
  734.             while( wordlen >= 8 ) \
  735.             { \
  736.                 unsigned long int t1, t2, t3, t4; \
  737.                 t1 = mysrc[0]; \
  738.                 t2 = mysrc[1]; \
  739.                 t3 = mysrc[2]; \
  740.                 t4 = mysrc[3]; \
  741.                 mydest[0] = t1; \
  742.                 mydest[1] = t2; \
  743.                 mydest[2] = t3; \
  744.                 mydest[3] = t4; \
  745.                 t1 = mysrc[4]; \
  746.                 t2 = mysrc[5]; \
  747.                 t3 = mysrc[6]; \
  748.                 t4 = mysrc[7]; \
  749.                 mydest[4] = t1; \
  750.                 mydest[5] = t2; \
  751.                 mydest[6] = t3; \
  752.                 mydest[7] = t4; \
  753.                 wordlen -= 8; \
  754.                 mydest += 8; \
  755.                 mysrc += 8; \
  756.             } \
  757.             switch(wordlen) { \
  758.                 case 7: \
  759.                     mydest[6] = mysrc[6]; \
  760.                 case 6: \
  761.                     mydest[5] = mysrc[5]; \
  762.                 case 5: \
  763.                     mydest[4] = mysrc[4]; \
  764.                 case 4: \
  765.                     mydest[3] = mysrc[3]; \
  766.                 case 3: \
  767.                     mydest[2] = mysrc[2]; \
  768.                 case 2: \
  769.                     mydest[1] = mysrc[1]; \
  770.                 case 1: \
  771.                     mydest[0] = mysrc[0]; \
  772.             } \
  773.         } \
  774.     }
  775.  
  776. #define Data(dpy, data, len) \
  777. { \
  778.     shmdata_t *da_shmdata = dpy->shmdata;\
  779.     if (da_shmdata) { \
  780.         unsigned char *data_ptr; \
  781.         unsigned int *src_ptr = (unsigned int *)(data); \
  782.         int da_len = ( (len) + 3 ) & ~3; \
  783.         _XShmAlloc(data_ptr, unsigned char *, da_shmdata, dpy, da_len);\
  784.         shmbcopy( (int *)src_ptr, (int *)data_ptr, (len) ); \
  785.     } else if (dpy->bufptr + (len) <= dpy->bufmax) {\
  786.         bcopy(data, dpy->bufptr, (int)len);\
  787.         dpy->bufptr += ((len) + 3) & ~3;\
  788.     } else\
  789.         _XSend(dpy,(void *) data, len); \
  790. }
  791.  
  792. # else /* SGI_SHM_TRANS */
  793.  
  794. #define Data(dpy, data, len) \
  795.     if (dpy->bufptr + (len) <= dpy->bufmax) {\
  796.         bcopy(data, dpy->bufptr, (int)len);\
  797.         dpy->bufptr += ((len) + 3) & ~3;\
  798.     } else\
  799.         _XSend(dpy, data, len)
  800.  
  801. # endif /* SGI_SHM_TRANS */
  802.  
  803. #endif /* DataRoutineIsProcedure */
  804.  
  805.  
  806. /* Allocate bytes from the buffer.  No padding is done, so if
  807.  * the length is not a multiple of 4, the caller must be
  808.  * careful to leave the buffer aligned after sending the
  809.  * current request.
  810.  *
  811.  * "type" is the type of the pointer being assigned to.
  812.  * "ptr" is the pointer being assigned to.
  813.  * "n" is the number of bytes to allocate.
  814.  *
  815.  * Example: 
  816.  *    xTextElt *elt;
  817.  *    BufAlloc (xTextElt *, elt, nbytes)
  818.  */
  819.  
  820. #ifdef SGI_SHM_TRANS
  821.  
  822. #define BufAlloc(type, ptr, n) \
  823. { \
  824.     shmdata_t *ba_shmdata = dpy->shmdata;\
  825.     if ( ba_shmdata ) { \
  826.     _XShmAlloc(ptr, type, ba_shmdata, dpy, (n));\
  827.     } \
  828.     else { \
  829.     if (dpy->bufptr + (n) > dpy->bufmax) \
  830.             _XFlush (dpy); \
  831.     ptr = (type) dpy->bufptr; \
  832.     dpy->bufptr += (n); \
  833.     } \
  834. }
  835.  
  836. #else /* SGI_SHM_TRANS */
  837.  
  838. #define BufAlloc(type, ptr, n) \
  839.     if (dpy->bufptr + (n) > dpy->bufmax) \
  840.         _XFlush (dpy); \
  841.     ptr = (type) dpy->bufptr; \
  842.     dpy->bufptr += (n);
  843.  
  844. #endif /* SGI_SHM_TRANS */
  845.  
  846. /*
  847.  * provide emulation routines for smaller architectures
  848.  */
  849. #ifndef WORD64
  850. #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
  851. #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
  852. #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
  853. #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
  854. #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
  855. #endif /* not WORD64 */
  856.  
  857. #define PackData16(dpy,data,len) Data16 (dpy, data, len)
  858. #define PackData32(dpy,data,len) Data32 (dpy, data, len)
  859.  
  860. /* Xlib manual is bogus */
  861. #define PackData(dpy,data,len) PackData16 (dpy, data, len)
  862.  
  863. #define min(a,b) (((a) < (b)) ? (a) : (b))
  864. #define max(a,b) (((a) > (b)) ? (a) : (b))
  865.  
  866. #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
  867.                  (((cs)->rbearing|(cs)->lbearing| \
  868.                    (cs)->ascent|(cs)->descent) == 0))
  869.  
  870. /* 
  871.  * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
  872.  * character.  If the character is in the column and exists, then return the
  873.  * appropriate metrics (note that fonts with common per-character metrics will
  874.  * return min_bounds).  If none of these hold true, try again with the default
  875.  * char.
  876.  */
  877. #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
  878. { \
  879.     cs = def; \
  880.     if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
  881.     if (fs->per_char == NULL) { \
  882.         cs = &fs->min_bounds; \
  883.     } else { \
  884.         cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
  885.         if (CI_NONEXISTCHAR(cs)) cs = def; \
  886.     } \
  887.     } \
  888. }
  889.  
  890. #define CI_GET_DEFAULT_INFO_1D(fs,cs) \
  891.   CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
  892.  
  893.  
  894.  
  895. /*
  896.  * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and 
  897.  * column.  This is used for fonts that have more than row zero.
  898.  */
  899. #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
  900. { \
  901.     cs = def; \
  902.     if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
  903.     col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
  904.     if (fs->per_char == NULL) { \
  905.         cs = &fs->min_bounds; \
  906.     } else { \
  907.         cs = &fs->per_char[((row - fs->min_byte1) * \
  908.                     (fs->max_char_or_byte2 - \
  909.                  fs->min_char_or_byte2 + 1)) + \
  910.                    (col - fs->min_char_or_byte2)]; \
  911.         if (CI_NONEXISTCHAR(cs)) cs = def; \
  912.         } \
  913.     } \
  914. }
  915.  
  916. #define CI_GET_DEFAULT_INFO_2D(fs,cs) \
  917. { \
  918.     unsigned int r = (fs->default_char >> 8); \
  919.     unsigned int c = (fs->default_char & 0xff); \
  920.     CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
  921. }
  922.  
  923.  
  924. #ifdef MUSTCOPY
  925.  
  926. /* for when 32-bit alignment is not good enough */
  927. #define OneDataCard32(dpy,dstaddr,srcvar) \
  928.   { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
  929.  
  930. #else
  931.  
  932. /* srcvar must be a variable for large architecture version */
  933. #define OneDataCard32(dpy,dstaddr,srcvar) \
  934.   { *(unsigned long *)(dstaddr) = (srcvar); }
  935.  
  936. #endif /* MUSTCOPY */
  937.  
  938. typedef struct _XInternalAsync {
  939.     struct _XInternalAsync *next;
  940.     Bool (*handler)();
  941.     XPointer data;
  942. } _XAsyncHandler;
  943.  
  944. typedef struct _XAsyncEState {
  945.     unsigned long min_sequence_number;
  946.     unsigned long max_sequence_number;
  947.     unsigned char error_code;
  948.     unsigned char major_opcode;
  949.     unsigned short minor_opcode;
  950.     unsigned char last_error_received;
  951.     int error_count;
  952. } _XAsyncErrorState;
  953.  
  954. #define DeqAsyncHandler(dpy,handler) { \
  955.     if (dpy->async_handlers == (handler)) \
  956.     dpy->async_handlers = (handler)->next; \
  957.     else \
  958.     _XDeqAsyncHandler(dpy, handler); \
  959.     }
  960.  
  961. /*
  962.  * This structure is private to the library.
  963.  */
  964. typedef struct _XFreeFuncs {
  965.     void (*atoms)();        /* _XFreeAtomTable */
  966.     int (*modifiermap)();    /* XFreeModifierMap */
  967.     void (*key_bindings)();    /* _XFreeKeyBindings */
  968.     void (*context_db)();    /* _XFreeContextDB */
  969.     void (*defaultCCCs)();    /* _XcmsFreeDefaultCCCs */
  970.     void (*clientCmaps)();    /* _XcmsFreeClientCmaps */
  971.     void (*intensityMaps)();    /* _XcmsFreeIntensityMaps */
  972.     void (*im_filters)();    /* _XFreeIMFilters */
  973.     void (*xkb)();        /* _XkbFreeInfo */
  974. } _XFreeFuncRec;
  975.  
  976. /*
  977.  * This structure is private to the library.
  978.  */
  979. typedef struct _XExten {    /* private to extension mechanism */
  980.     struct _XExten *next;    /* next in list */
  981.     XExtCodes codes;    /* public information, all extension told */
  982.     int (*create_GC)();    /* routine to call when GC created */
  983.     int (*copy_GC)();    /* routine to call when GC copied */
  984.     int (*flush_GC)();    /* routine to call when GC flushed */
  985.     int (*free_GC)();    /* routine to call when GC freed */
  986.     int (*create_Font)();    /* routine to call when Font created */
  987.     int (*free_Font)();    /* routine to call when Font freed */
  988.     int (*close_display)();    /* routine to call when connection closed */
  989.     int (*error)();        /* who to call when an error occurs */
  990.         char *(*error_string)();  /* routine to supply error string */
  991.     char *name;        /* name of this extension */
  992.     void (*error_values)(); /* routine to supply error values */
  993. } _XExtension;
  994.  
  995.  
  996. /* extension hooks */
  997.  
  998. _XFUNCPROTOBEGIN
  999.  
  1000. #ifdef DataRoutineIsProcedure
  1001. extern void Data();
  1002. #endif
  1003. extern int _XError();            /* prepare to upcall user handler */
  1004. extern int _XIOError();            /* prepare to upcall user handler */
  1005. extern int (*_XIOErrorFunction)();    /* X system error reporting routine. */
  1006. extern int (*_XErrorFunction)();    /* X_Error event reporting routine. */
  1007. #if NeedFunctionPrototypes
  1008. #ifdef SGI_SHM_TRANS
  1009. extern unsigned char *_XShmRealAlloc(Display *, unsigned long int);
  1010. extern void _XShmCompatBufCopy(Display *);
  1011. extern void _XShmFastBcopy(volatile int *, volatile int *, int);
  1012. #endif
  1013. extern void _XEatData(Display *, unsigned long);/* swallow data from server */
  1014. extern int _XFlush(Display *);
  1015. #ifdef NEED_REPLIES
  1016. extern Status _XReply(Display *, xReply *, int, Bool);
  1017. #endif
  1018. extern int _XRead(Display *, void *, long);
  1019. extern int _XSend(Display *, void *, long);
  1020. #else
  1021. extern void _XEatData();        /* swallow data from server */
  1022. #endif
  1023. extern char *_XAllocScratch();        /* fast memory allocator */
  1024. extern Visual *_XVIDtoVisual();        /* given visual id, find structure */
  1025. extern unsigned long _XSetLastRequestRead();    /* update dpy->last_request_read */
  1026. extern int _XGetHostname();        /* get name of this machine */
  1027. extern Screen *_XScreenOfWindow ();    /* get Screen pointer for window */
  1028. extern Bool _XAsyncErrorHandler ();    /* internal error handler */
  1029. extern char *_XGetAsyncReply();        /* get async reply */
  1030.  
  1031. extern int (*XESetCreateGC(
  1032. #if NeedFunctionPrototypes
  1033.     Display*        /* display */,
  1034.     int            /* extension */,
  1035.     int (*) (
  1036. #if NeedNestedPrototypes
  1037.           Display*            /* display */,
  1038.           GC            /* gc */,
  1039.           XExtCodes*        /* codes */
  1040. #endif
  1041.         )        /* proc */
  1042. #endif
  1043. ))(
  1044. #if NeedNestedPrototypes
  1045.     Display*, GC, XExtCodes*
  1046. #endif
  1047. );
  1048.  
  1049. extern int (*XESetCopyGC(
  1050. #if NeedFunctionPrototypes
  1051.     Display*        /* display */,
  1052.     int            /* extension */,
  1053.     int (*) (
  1054. #if NeedNestedPrototypes
  1055.           Display*            /* display */,
  1056.               GC            /* gc */,
  1057.               XExtCodes*        /* codes */
  1058. #endif
  1059.             )        /* proc */          
  1060. #endif
  1061. ))(
  1062. #if NeedNestedPrototypes
  1063.     Display*, GC, XExtCodes*
  1064. #endif
  1065. );
  1066.  
  1067. extern int (*XESetFlushGC(
  1068. #if NeedFunctionPrototypes
  1069.     Display*        /* display */,
  1070.     int            /* extenstion */,
  1071.     int (*) (
  1072. #if NeedNestedPrototypes
  1073.           Display*            /* display */,
  1074.               GC            /* gc */,
  1075.               XExtCodes*        /* codes */
  1076. #endif
  1077.             )        /* proc */         
  1078. #endif
  1079. ))(
  1080. #if NeedNestedPrototypes
  1081.     Display*, GC, XExtCodes*
  1082. #endif
  1083. );
  1084.  
  1085. extern int (*XESetFreeGC(
  1086. #if NeedFunctionPrototypes
  1087.     Display*        /* display */,
  1088.     int            /* extension */,
  1089.     int (*) (
  1090. #if NeedNestedPrototypes
  1091.           Display*            /* display */,
  1092.               GC            /* gc */,
  1093.               XExtCodes*        /* codes */
  1094. #endif
  1095.             )        /* proc */         
  1096. #endif
  1097. ))(
  1098. #if NeedNestedPrototypes
  1099.     Display*, GC, XExtCodes*
  1100. #endif
  1101. );
  1102.  
  1103. extern int (*XESetCreateFont(
  1104. #if NeedFunctionPrototypes
  1105.     Display*        /* display */,
  1106.     int            /* extension */,
  1107.     int (*) (
  1108. #if NeedNestedPrototypes
  1109.           Display*            /* display */,
  1110.               XFontStruct*        /* fs */,
  1111.               XExtCodes*        /* codes */
  1112. #endif
  1113.             )        /* proc */    
  1114. #endif
  1115. ))(
  1116. #if NeedNestedPrototypes
  1117.     Display*, XFontStruct*, XExtCodes*
  1118. #endif
  1119. );
  1120.  
  1121. extern int (*XESetFreeFont(
  1122. #if NeedFunctionPrototypes
  1123.     Display*        /* display */,
  1124.     int            /* extension */,
  1125.     int (*) (
  1126. #if NeedNestedPrototypes
  1127.           Display*            /* display */,
  1128.               XFontStruct*        /* fs */,
  1129.               XExtCodes*        /* codes */
  1130. #endif
  1131.             )        /* proc */    
  1132. #endif
  1133. ))(
  1134. #if NeedNestedPrototypes
  1135.     Display*, XFontStruct*, XExtCodes*
  1136. #endif
  1137. ); 
  1138.  
  1139. extern int (*XESetCloseDisplay(
  1140. #if NeedFunctionPrototypes
  1141.     Display*        /* display */,
  1142.     int            /* extension */,
  1143.     int (*) (
  1144. #if NeedNestedPrototypes
  1145.           Display*            /* display */,
  1146.               XExtCodes*        /* codes */
  1147. #endif
  1148.             )        /* proc */    
  1149. #endif
  1150. ))(
  1151. #if NeedNestedPrototypes
  1152.     Display*, XExtCodes*
  1153. #endif
  1154. );
  1155.  
  1156. extern int (*XESetError(
  1157. #if NeedFunctionPrototypes
  1158.     Display*        /* display */,
  1159.     int            /* extension */,
  1160.     int (*) (
  1161. #if NeedNestedPrototypes
  1162.           Display*            /* display */,
  1163.               xError*            /* err */,
  1164.               XExtCodes*        /* codes */,
  1165.               int*            /* ret_code */
  1166. #endif
  1167.             )        /* proc */    
  1168. #endif
  1169. ))(
  1170. #if NeedNestedPrototypes
  1171.     Display*, xError*, XExtCodes*, int*
  1172. #endif
  1173. );
  1174.  
  1175. extern char* (*XESetErrorString(
  1176. #if NeedFunctionPrototypes
  1177.     Display*        /* display */,
  1178.     int            /* extension */,
  1179.     char* (*) (
  1180. #if NeedNestedPrototypes
  1181.             Display*        /* display */,
  1182.                 int            /* code */,
  1183.                 XExtCodes*        /* codes */,
  1184.                 char*            /* buffer */,
  1185.                 int            /* nbytes */
  1186. #endif
  1187.               )        /* proc */           
  1188. #endif
  1189. ))(
  1190. #if NeedNestedPrototypes
  1191.     Display*, int, XExtCodes*, char*, int
  1192. #endif
  1193. );
  1194.  
  1195. extern void (*XESetPrintErrorValues (
  1196. #if NeedFunctionPrototypes
  1197.     Display*        /* display */,
  1198.     int            /* extension */,
  1199.     void (*)(
  1200. #if NeedNestedPrototypes
  1201.           Display*            /* display */,
  1202.           XErrorEvent*        /* ev */,
  1203.           void*            /* fp */
  1204. #endif
  1205.          )        /* proc */
  1206. #endif
  1207. ))(
  1208. #if NeedNestedPrototypes
  1209.     Display*, XErrorEvent*, void*
  1210. #endif
  1211. );
  1212.  
  1213. extern int (*XESetWireToEvent(
  1214. #if NeedFunctionPrototypes
  1215.     Display*        /* display */,
  1216.     int            /* event_number */,
  1217.     Bool (*) (
  1218. #if NeedNestedPrototypes
  1219.            Display*            /* display */,
  1220.                XEvent*            /* re */,
  1221.                xEvent*            /* event */
  1222. #endif
  1223.              )        /* proc */    
  1224. #endif
  1225. ))(
  1226. #if NeedNestedPrototypes
  1227.     Display*, XEvent*, xEvent*
  1228. #endif
  1229. );
  1230.  
  1231. extern Status (*XESetEventToWire(
  1232. #if NeedFunctionPrototypes
  1233.     Display*        /* display */,
  1234.     int            /* event_number */,
  1235.     int (*) (
  1236. #if NeedNestedPrototypes
  1237.           Display*            /* display */,
  1238.               XEvent*            /* re */,
  1239.               xEvent*            /* event */
  1240. #endif
  1241.             )        /* proc */   
  1242. #endif
  1243. ))(
  1244. #if NeedNestedPrototypes
  1245.     Display*, XEvent*, xEvent*
  1246. #endif
  1247. );
  1248.  
  1249. extern Status (*XESetWireToError(
  1250. #if NeedFunctionPrototypes
  1251.     Display*        /* display */,
  1252.     int            /* error_number */,
  1253.     Bool (*) (
  1254. #if NeedNestedPrototypes
  1255.            Display*            /* display */,
  1256.            XErrorEvent*        /* he */,
  1257.            xError*            /* we */
  1258. #endif
  1259.             )        /* proc */   
  1260. #endif
  1261. ))(
  1262. #if NeedNestedPrototypes
  1263.     Display*, XErrorEvent*, xError*
  1264. #endif
  1265. );
  1266.  
  1267. _XFUNCPROTOEND
  1268.